home *** CD-ROM | disk | FTP | other *** search
- { tmouse.pas -- Test mouse clicks in windows }
-
- program TMouse;
-
- uses WinTypes, WinProcs, WObjects;
-
- type
-
- MouseApplication = object(TApplication)
- procedure InitMainWindow; virtual;
- end;
-
- PMouseWindow = ^MouseWindow;
- MouseWindow = object(TWindow)
- constructor Init(AParent: PWindowsObject; ATitle: PChar);
- procedure WMLButtonDown(var Msg: TMessage);
- virtual wm_First + wm_LButtonDown;
- procedure WMRButtonDown(var Msg: TMessage);
- virtual wm_First + wm_RButtonDown;
- end;
-
- { MouseApplication }
-
- {- Initialize the application's window }
- procedure MouseApplication.InitMainWindow;
- begin
- MainWindow := New(PMouseWindow,
- Init(nil, 'Click a Mouse Button Inside This Window'))
- end;
-
- { MouseWindow }
-
- {- Initialize the application's window object }
- constructor MouseWindow.Init(AParent: PWindowsObject; ATitle: PChar);
- begin
- TWindow.Init(AParent, ATitle);
- with Attr do
- begin
- X := 20; Y := 20; W := 350; H := 150
- end
- end;
-
- {- Respond to left-button-down mouse clicks }
- procedure MouseWindow.WMLButtonDown(var Msg: TMessage);
- begin
- MessageBeep(0);
- MessageBox(HWindow, 'Left Button Down', 'Message Box', mb_Ok)
- end;
-
- {- Respond to right-button-down mouse clicks }
- procedure MouseWindow.WMRButtonDown(var Msg: TMessage);
- begin
- MessageBeep(0);
- MessageBox(HWindow, 'Right Button Down', 'Message Box', mb_Ok)
- end;
-
- var
-
- MouseApp: MouseApplication;
-
- begin
- MouseApp.Init('TMouse');
- MouseApp.Run;
- MouseApp.Done
- end.
-
-
- { --------------------------------------------------------------
- Copyright (c) 1991 by Tom Swan. All rights reserved.
- Revision 1.00 Date: 1/11/1991
- ------------------------------------------------------------- }
-
-
-
-